home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Atari Compendium
/
The Atari Compendium (Toad Computers) (1994).iso
/
files
/
umich
/
tex
/
td187src.lzh
/
MAGICVDI.I
< prev
next >
Wrap
Text File
|
1991-06-08
|
32KB
|
1,336 lines
(*######################################################################
MAGIC Modula's All purpose GEM Interface Cadre
¯ ¯ ¯ ¯ ¯
########################################################################
VDI Virtual Device Interface Interface for Modula-2
########################################################################
V2.02 03.04.91 Jens Pirnay SetUserfillpattern korrigiert
V2.01 24.10.90 Peter Hellinger Systemaufrufe jetzt in MagicSys
dadurch ist das Modul unabhängig
V2.00 16.10.90 Peter Hellinger Anpassung an neues MagicSys
V1.04 05.08.90 Peter Hellinger
V1.01 18.06.90 Peter Hellinger Bug in GDos() gefixt
V1.00 (C) by Peter Hellinger
######################################################################*)
IMPLEMENTATION MODULE MagicVDI;
(*------------------------------*)
(* COMPILERSWITCHES *)
(*------------------------------*)
(* TDI-Version: DEAKTIVIERT *)
(*------------------------------*)
(* V- Overflow-Checks *)
(* R- Range-Checks *)
(* S- Stack-Check *)
(* N- NIL-Checks *)
(* T- TDI-Compiler vor 3.01 *)
(* Q+ Branch statt Jumps *)
(* *)
(*------------------------------*)
(* MM2-Version: AKTIVIERT *)
(*------------------------------*)
(*$R- Range-Checks *)
(*$S- Stack-Check *)
(* *)
(*------------------------------*)
FROM SYSTEM IMPORT ADDRESS, ADR;
FROM MagicSys IMPORT Nil, Null, Bit0, Bit1, Bit2, Bit3, Bit4, Bit5, Bit6,
Bit7, Bit8, Bit9, Bit10, Bit11, Bit12, Bit13, Bit14,
Bit15, LOC, Byte, ByteSet, sWORD, sINTEGER, sCARDINAL,
sBITSET, lWORD, lINTEGER, lCARDINAL, lBITSET,
CastToChar, CastToByte, CastToByteset, CastToInt,
CastToCard, CastToBitset, CastToWord, CastToLInt,
CastToLCard, CastToLBitset, CastToLWord, CastToAddr,
CallGEM, CatchD0;
IMPORT MagicSys;
VAR array: POINTER TO ARRAY [0..255] OF sINTEGER;
vdipb: ADDRESS; (* Adresse des VDI-Parameterblocks *)
PROCEDURE VDICall (c0, c1, c3, c5, c6: sINTEGER);
BEGIN
VDIControl[0]:= c0;
VDIControl[1]:= c1;
VDIControl[3]:= c3;
VDIControl[5]:= c5;
VDIControl[6]:= c6;
CallGEM (115, vdipb);
END VDICall;
PROCEDURE VqGDos(): BOOLEAN;
BEGIN
RETURN MagicSys.VqGdos ();
END VqGDos;
(*#######################################################################*)
PROCEDURE SetWritemode (handle, mode: sINTEGER): sINTEGER;
BEGIN
VDIIntIn[0]:= mode;
VDICall (32, 0, 1, 0, handle);
RETURN VDIIntOut[0];
END SetWritemode;
PROCEDURE SetColor (handle, index: sINTEGER; VAR rgb: ARRAY OF LOC);
BEGIN
VDIIntIn[0]:= index;
array:= ADR (rgb);
VDIIntIn[1]:= array^[0];
VDIIntIn[2]:= array^[1];
VDIIntIn[3]:= array^[2];
VDICall(14, 0, 4, 0, handle);
END SetColor;
PROCEDURE SetLinetype (handle, style: sINTEGER): sINTEGER;
BEGIN
VDIIntIn[0]:= style;
VDICall (15, 0, 1, 0, handle);
RETURN VDIIntOut[0];
END SetLinetype;
PROCEDURE SetUserlinestyle (handle: sINTEGER; style: ARRAY OF LOC);
BEGIN
VDIIntIn[0]:= CastToInt (style);
VDICall (113, 0, 1, 0, handle);
END SetUserlinestyle;
PROCEDURE SetLinewidth (handle, width: sINTEGER): sINTEGER;
BEGIN
VDIPtsIn[0]:= width;
VDIPtsIn[1]:= 0;
VDICall (16, 1, 0, 0, handle);
RETURN VDIPtsOut[0];
END SetLinewidth;
PROCEDURE SetLinecolor (handle, color: sINTEGER): sINTEGER;
BEGIN
VDIIntIn[0]:= color;
VDICall (17, 0, 1, 0, handle);
RETURN VDIIntOut[0];
END SetLinecolor;
PROCEDURE SetLineEndstyles (handle, begin, end: sINTEGER);
BEGIN
VDIIntIn[0]:= begin;
VDIIntIn[1]:= end;
VDICall (108, 0, 2, 0, handle);
END SetLineEndstyles;
PROCEDURE SetMarkertype (handle, type: sINTEGER): sINTEGER;
BEGIN
VDIIntIn[0]:= type;
VDICall (18, 0, 1, 0, handle);
RETURN VDIIntOut[0];
END SetMarkertype;
PROCEDURE SetMarkerheight (handle, height: sINTEGER): sINTEGER;
BEGIN
VDIPtsIn[0]:= height;
VDIPtsIn[1]:= 0;
VDICall (19, 1, 0, 0, handle);
RETURN VDIPtsOut[0];
END SetMarkerheight;
PROCEDURE SetMarkercolor (handle, index: sINTEGER): sINTEGER;
BEGIN
VDIIntIn[0]:= index;
VDICall (20, 0, 1, 0, handle);
RETURN VDIIntOut[0];
END SetMarkercolor;
PROCEDURE SetCharheight (handle, hi: sINTEGER; VAR cw, ch, bw, bh: sINTEGER);
BEGIN
VDIPtsIn[0]:= 0;
VDIPtsIn[1]:= hi;
VDICall (12, 1, 0, 0, handle);
cw:= VDIPtsOut[0];
ch:= VDIPtsOut[1];
bw:= VDIPtsOut[2];
bh:= VDIPtsOut[3];
END SetCharheight;
PROCEDURE SetCharpoints (handle, hi: sINTEGER; VAR cw, ch, bw, bh: sINTEGER): sINTEGER;
BEGIN
VDIIntIn[0]:= hi;
VDICall (107, 0, 1, 0, handle);
cw:= VDIPtsOut[0];
ch:= VDIPtsOut[1];
bw:= VDIPtsOut[2];
bh:= VDIPtsOut[3];
RETURN VDIIntOut[0];
END SetCharpoints;
PROCEDURE SetCharbaseline (handle, angle: sINTEGER): sINTEGER;
BEGIN
VDIIntIn[0]:= angle;
VDICall (13, 0, 1, 0, handle);
RETURN VDIIntOut[0];
END SetCharbaseline;
PROCEDURE SetTextface (handle, font: sINTEGER): sINTEGER;
BEGIN
VDIIntIn[0]:= font;
VDICall (21, 0, 1, 0, handle);
RETURN VDIIntOut[0];
END SetTextface;
PROCEDURE SetTextcolor (handle, index: sINTEGER): sINTEGER;
BEGIN
VDIIntIn[0]:= index;
VDICall (22, 0, 1, 0, handle);
RETURN VDIIntOut[0];
END SetTextcolor;
PROCEDURE SetTexteffect (handle: sINTEGER; effect: sBITSET): sBITSET;
BEGIN
VDIIntIn[0]:= CastToInt (effect);
VDICall (106, 0, 1, 0, handle);
RETURN CastToBitset (VDIIntOut[0]);
END SetTexteffect;
PROCEDURE SetTextalignment (handle, hin, vin: sINTEGER; VAR ho, vo: sINTEGER);
BEGIN
VDIIntIn[0]:= hin;
VDIIntIn[1]:= vin;
VDICall (39, 0, 2, 0, handle);
ho:= VDIIntOut[0];
vo:= VDIIntOut[1];
END SetTextalignment;
PROCEDURE SetFillinterior (handle, index: sINTEGER): sINTEGER;
BEGIN
VDIIntIn[0]:= index;
VDICall (23, 0, 1, 0, handle);
RETURN VDIIntOut[0];
END SetFillinterior;
PROCEDURE SetFillstyle (handle, style: sINTEGER): sINTEGER;
BEGIN
VDIIntIn[0]:= style;
VDICall (24, 0, 1, 0, handle);
RETURN VDIIntOut[0];
END SetFillstyle;
PROCEDURE SetFillcolor (handle, index: sINTEGER): sINTEGER;
BEGIN
VDIIntIn[0]:= index;
VDICall (25, 0, 1, 0, handle);
RETURN VDIIntOut[0];
END SetFillcolor;
PROCEDURE SetFillperimeter (handle: sINTEGER; border: BOOLEAN): BOOLEAN;
BEGIN
IF border THEN VDIIntIn[0]:= 1; ELSE VDIIntIn[0]:= 0; END;
VDICall (104, 0, 1, 0, handle);
RETURN VDIIntOut[0] = 1;
END SetFillperimeter;
PROCEDURE SetUserfillpattern (handle: sINTEGER; VAR pat: ARRAY OF LOC);
VAR old: ADDRESS;
BEGIN
old:= VDIPB.intin;
VDIPB.intin:= ADR (pat);
(** Alter Aufruf: damit ging aber alles schief...
VDICall (112, 0, HIGH(pat) * 16, 0, handle);
**)
VDICall (112, 0, HIGH(pat), 0, handle);
VDIPB.intin:= old;
END SetUserfillpattern;
(*#######################################################################*)
PROCEDURE OpenWorkstation (VAR in: ARRAY OF LOC; VAR handle: sINTEGER;
VAR out: ARRAY OF LOC);
VAR c: sINTEGER;
BEGIN
array:= ADR (in);
FOR c:= 0 TO 10 DO VDIIntIn[c]:= array^[c]; END;
VDICall(1, 0, 11, 0, handle);
handle:= VDIControl[6];
array:= ADR (out);
FOR c:= 0 TO 44 DO array^[c]:= VDIIntOut[c]; END;
FOR c:= 0 TO 11 DO array^[c+44]:= VDIPtsOut[c]; END;
END OpenWorkstation;
PROCEDURE CloseWorkstation (handle: sINTEGER);
BEGIN
VDICall(2, 0, 0, 0, handle);
END CloseWorkstation;
PROCEDURE OpenVirtual (VAR in: ARRAY OF LOC; VAR handle: sINTEGER;
VAR out: ARRAY OF LOC);
VAR c: sINTEGER;
BEGIN
array:= ADR (in);
FOR c:= 0 TO 10 DO VDIIntIn[c]:= array^[c]; END;
VDICall(100, 0, 11, 0, handle);
handle:= VDIControl[6];
array:= ADR (out);